# 因为要用sleep所以要import
import time
scale = 100
#“/”表示浮点数除法，有小数点，“//”整数除法."%"余数除法
print("执行开始".center(scale // 2, '-'))
start = time.perf_counter()
for i in range(scale + 1):  # i是从0开始循环
    a = '*' * i
    b = '.' * (scale - i)
    c = (i / scale) * 100
    dur = time.perf_counter() - start
    # {}互相对应a b c dur enf=''不换行
    print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c, a, b,dur), end='')
    time.sleep(0.1)
print("\n" + "执行结束".center(scale // 2, '-'))
